#!/bin/bash

# check dependencies
if [ -e check.part.bash ]; then
	echo "Checking dependencies .."
	if ! bash check.part.bash 1>&2; then
		echo "** Error: Dependency check failed" 1>&2
		exit 1
	fi
	echo "Dependency check succeeded"
fi

# execute the upgrade script
if [ -e upgrade.part.bash ]; then
	if bash upgrade.part.bash; then
		echo "=== Successful upgrade! ==="
	else
		echo "** Error during upgrade. Unknown state remains, possibly inconsistent" 1>&2
	fi
else
	echo "** Nothing to do!" 1>&2
fi

